/* eslint valid-jsdoc: "off" */

'use strict'

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = (exports = {})

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1605496633775_5973'

  // add your middleware config here
  config.middleware = []

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',

    // 开发服务器的设置
    // 指定`hostname`,就不能使用`localhost`
    cluster: { listen: { port: 8889, hostname: '127.0.0.1' } },

    // 配置 mongoDB 数据库链接
    mongoose: {
      client: {
        url: 'mongodb://127.0.0.1:27017/afaire', // afaire是自定义数据库的名称
        options: {
          // https://mongoosejs.com/docs/deprecations.html
          useNewUrlParser: true,
          useUnifiedTopology: true,
        },
      },
    },

    // 文件上传
    multipart: { fileSize: '50mb' },
  }

  return {
    ...config,
    ...userConfig,
  }
}
